//
//  Common.swift
//  MicroBlog
//
//  Created by 002 on 15/10/16.
//  Copyright © 2015年 002. All rights reserved.
//

import UIKit

// MARK: - 全局通知定义
/// 切换根视图控制器通知 － 一定要够长，要有前缀
let WBSwitchRootViewControllerNotification = "WBSwitchRootViewControllerNotification"

/// 选中照片通知
let WBStatusSelectedPhotoNotification = "WBStatusSelectedPhotoNotification"
/// 选中照片索引 KEY - IndexPath
let WBStatusSelectedPhotoIndexPathKey = "WBStatusSelectedPhotoIndexPathKey"
/// 选中照片的数组 - KEY - thumbnailUrls
let WBStatusSelectedPhotoURLSKey = "WBStatusSelectedPhotoURLSKey"

/// MARK:全局函数
///
/// :param: delaytime 延迟时间
/// :param: callBack  执行的闭包
func delay(delaytime: Double, callBack: ()->()) {
    
    dispatch_after(
        dispatch_time(DISPATCH_TIME_NOW, Int64(delaytime * Double(NSEC_PER_SEC))),
        dispatch_get_main_queue()) {
            
            callBack()
    }
}

let AppearanceTintColor = UIColor.orangeColor()
// 0 -1 之间的随机数
let randomNumberBetween0And1 = CGFloat((random() % 254)) /  CGFloat(255)
let RandomColor = UIColor.init(red: CGFloat((random() % 254)) /  CGFloat(255), green:CGFloat((random() % 254)) /  CGFloat(255), blue: CGFloat((random() % 255)) /  CGFloat(255), alpha: 1)